<style type="text/css">
.button{background:url(images/left-menu-li.gif) repeat-x left top #F1F6F9; border:1px solid #318DAC; font-weight:bold; padding:2px 5px; font-weight:lighter; color:#318DAC; vertical-align:middle; -moz-border-radius:3px; -webkit-border-radius:3px; margin:auto 5px}
.center{text-align:center;}
.product_op{height:30px;}
.product_op span{cursor:pointer;}
.packageTips,.validateTips{color:red;line-height:25px;}
</style>

<style type="text/css">
div#add{
	text-align:center;
}
div.info{
	text-align:left;
}
div.item{
	margin-bottom: 12px;
}
input.text {
    height: 22px;    
    margin-left: 8px;
}
span.text{
	margin-left: 8px;
}
span.userInfoLeft{
	display:block;
	float:left;
	width:100px;
}
.hidden{display:none;}
</style>

<script type="text/javascript">
	$(function(){
		$("#list td").dblclick(function(){
			$(this).children("span").hide();
			$(this).children("input").removeClass("hidden").focus().blur(function(){			
				var val = $(this).val();
				$(this).siblings("span").text(val).show();
				$(this).addClass("hidden");
			});
		});
		
			
		// 弹出<{$lang.tip}>
		$("#alert_msg").dialog({
				autoOpen : false,
				modal : true,
				width : 600,
				show : "slide",
				buttons : {
					'<{$lang.ok}>[<{$lang.return}><{$lang.list}>]' : function() {
						window.location.href = "/product/product/index";
					},
					'<{$lang.close}>' : function() {
						$(this).dialog('close');
					}
				}

			});
	});
	function del(obj){
		
		if(window.confirm("<{$lang.delete}><{$lang.msg}>？")){
			$(obj).parent().parent().remove();		
		}
		return false;
	}
	
		
	function save() {
		vForm = '';
		vForm = $("#batchAddForm").serializeArray();		
		var tip = '';
		loading();
		$.ajax({
			type : "POST",
			async : false,
			dataType : "json",
			url : "/product/product/batch-add", // 请求的处理url
			data : vForm,
			success : function(json) {
				closeLoading();
				if (json.ask) {				
					$('#alert_msg p').html(json.msg);
					$('#alert_msg').dialog('open');
				} 
			}
		});
	}
		
</script>
<div id="right_confirm" style="display: none;">
	<p style="text-align:center;font-size: 14px;color: red;font-weight: bold;">
	
	</p>
</div>

<div id="alert_msg" style="display: none;" title="<{$lang.tip}><{$lang.msg}>">
	<p style="font-size: 14px;">
	
	</p>
</div>

<h3><{$lang.batch}><{$lang.add}><{$lang.product}>
</h3>
<{if $err eq ""}>     
<form id="batchAddForm" name="batchAddForm">
<table width="100%" border="0" cellspacing="0" cellpadding="0" class="myTab">	
	<thead><tr>    	
    	<th><{$lang.product}><{$lang.sku}></th>
   		<th><{$lang.customer_code}></th>
    	<th><{$lang.product}><{$lang.name}></th>
        <th><{$lang.category}></th>        
        <th><{$lang.length}>(cm)</th>    
        <th><{$lang.width}>(cm)</th>    
        <th><{$lang.height}>(cm)</th>
        <th><{$lang.weight}></th>
        <th><{$lang.declar_price}></th>
        <th><{$lang.min_quantity}></th>
        
        <th><{$lang.operation}></th>
	</tr></thead>
    
	<tbody id="list">	
		<{foreach from=$products item=product key=key}>                    
		<tr class="">			
			
			<td>
				<span><{$product.<{$lang.sku}>No}></span>
				<input type="text" name="<{$lang.sku}>No[<{$key}>]" value="<{$product.<{$lang.sku}>No}>" class="hidden"/>
			</td>
			<td>
				<span><{$product.customer_id}></span>
				<input type="text" name="customer_id[<{$key}>]" value="<{$product.customer_id}>" class="hidden"/>
			</td>
			<td>
				<span><{$product.<{$lang.sku}>Name}></span>
				<input type="text" name="<{$lang.sku}>Name[<{$key}>]" value="<{$product.<{$lang.sku}>Name}>" class="hidden"/>
			</td>
			<td>
				<span><{$product.Category}></span>
				<input type="text" name="Category[<{$key}>]" value="<{$product.Category}>" class="hidden"/>
			</td>
			<td>
				<span><{$product.product_length}></span>
				<input type="text" name="product_length[<{$key}>]" value="<{$product.product_length}>" class="hidden" size=5/>
			</td>
			<td>
				<span><{$product.product_width}></span>
				<input type="text" name="product_width[<{$key}>]" value="<{$product.product_width}>" class="hidden" size=5/>
			</td>
			<td>
				<span><{$product.product_height}></span>
				<input type="text" name="product_height[<{$key}>]" value="<{$product.product_height}>" class="hidden" size=5/>
			</td>
			<td>
				<span><{$product.product_weight}></span>
				<input type="text" name="product_weight[<{$key}>]" value="<{$product.product_weight}>" class="hidden" size=5/>
			</td>	
			<td>
				<span><{$product.product_declared_value}></span>
				<input type="text" name="product_declared_value[<{$key}>]" value="<{$product.product_declared_value}>" class="hidden" size=5/>
			</td>
			<td>
				<span><{$product.Min_Qty}></span>
				<input type="text" name="Min_Qty[<{$key}>]" value="<{$product.Min_Qty}>" class="hidden" size=5/>
			</td>		
			
			<td>
				<a title="<{$lang.delete}>" href="javascript:;" onclick="del(this);"><img
						src="/images/icon/delete.gif" alt="<{$lang.delete}>"/></a>
			</td>
		</tr>
		<{/foreach}>
		

	</tbody>
	<tfooter>
		<tr class="">	
			
			<td colspan='11'>
				<input class="button" type="button" value="  <{$lang.submit}>  "   onclick="save()">&nbsp;&nbsp;
				<input class="button" type="button" value="  <{$lang.return}>  "   onclick="history.go(-1);">&nbsp;&nbsp;
			</td>
			
		</tr>
	</tfooter>
	
</table>
</form>
<{else}>
<p style="font-size: 14px;color:red;font-weight:bold;text-align:center">
	<{$err}><a href="javascript:;" onclick="history.go(-1);" style="padding:0 0 0 20px;font-size:12px;color:#000;font-weight:normal;"><{$lang.return}></a>
</p>
<{/if}>


